package com.endurance.facade;

import com.endurance.service.IntegerService;
import com.endurance.service.LogService;
import com.endurance.service.MessageService;
import com.endurance.service.PaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author: sunlin
 * @Date: 2024-05-20 8:48
 * @Version: 1.0
 * @Description:
 */
@Component
public class Facade {

    @Autowired
    private LogService logService;

    @Autowired
    private PaymentService paymentService;

    @Autowired
    private IntegerService integerService;

    @Autowired
    private MessageService messageService;

    /**
     * 外观模式， 把业务代码分类包装成好多个类，使逻辑结构看的比较清晰
     * 1. 收集日志
     * 2. 修改订单状态
     * 3. 调用积分服务接口
     * 4. 调用消息服务平台
     */
    public void facadeCallback() {

        logService.log();
        paymentService.updatePaymentStatus();
        integerService.addInteger();
        messageService.msg();
    }
}
